package com.gitee.wsl.ext.number

import kotlin.math.max
import kotlin.math.min

/**
 * Constrains a value between a minimum and maximum value.
 *
 * @method constrain
 * @param n   number to constrain
 * @param low  minimum limit
 * @param high maximum limit
 */
fun Float.constrain( low: Float, high: Float): Float {
    return max(min(this, high), low)
}